package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread rose = new Thread(){
          public void run(){
              for (int i = 0; i < 5; i++) {
                  System.out.println("rose: let me go! ");
                  try {
                      Thread.sleep(2500);

                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
              }
              System.out.println("啊啊啊啊啊啊啊!AAAAAAAAAA!aaaaaaaaaa!噗通");
          }
        };
        Thread jack = new Thread(){
            public void run() {
                while (true){
                    System.out.println("jack: you jump i jump !");
                    try {
                        Thread.sleep(2500);

                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        rose.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        jack.setDaemon(true);
        jack.start();
    }
}
